<template>
  <div class="container">
    <div class="item-left">
      <img :src="goods.img" alt="" />
    </div>
    <div class="item-right">
      <div class="item-right-item">品牌：{{ goods.name }}</div>
      <div class="item-right-item">型号：{{ goods.info }}</div>
      <div class="item-right-item">价格：{{ goods.price }}</div>
      <div class="item-right-item">
        数量： <i class="bi bi-dash-square goods-op" @click="subGoods(goods.id)"></i
        >{{ goods.num }} <i class="bi bi-plus-square goods-op" @click="addGoods(goods.id)"></i>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ['goods'],
  methods: {
    subGoods(id) {
      this.$emit('subGoods', id)
    },
    addGoods(id) {
      this.$emit('addGoods', id)
    },
  },
}
</script>

<style lang="scss" scoped>
.container {
  display: flex;
  width: 400px;
  height: 200px;
  border: 1px solid gray;
  .item-left {
    width: 200px;
    height: auto;
    img {
      width: 190px;
      height: 190px;
    }
  }
  .item-right {
    display: flex;
    flex-direction: column;
    .item-right-item {
      margin-top: 20px;
    }
  }
}
.goods-op {
  margin: 5px;
}
</style>
